/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.frm.ccm.session;

import javax.ejb.Local;
import merlion.frm.ccm.entity.CreditAccount;
import merlion.frm.ccm.entity.CreditGroup;
import merlion.crm.slcm.entity.Customer;
import java.util.List;
import merlion.crm.sopm.entity.SalesOrder;


/**
 *
 * @author Zhiqi & Yuwei
 */
@Local
public interface CCSessionBeanLocal {
    
    public boolean creditCheck(SalesOrder so);

    public CreditAccount getCustomerCreditAccount(Customer customer);

    public CreditGroup createCreditGroup(CreditGroup cg);

    public CreditGroup getCreditGroupById(Long id);
    
    public Boolean checkExistCreditGroupByTitle(String title);

    public CreditGroup updateCreditGroup(CreditGroup cg);

    public List<CreditGroup> getAllCreditGroup();
    
    // create new credit account. if success, return creditAccount object. If error, return null.
    public CreditAccount createCreditAccount(CreditAccount ca);
    
    //return true when removed successfully
    //return false when there are accounts linked to it, not able to remove the credit group
    public boolean removeCreditGroupById(Long id);
    public List<Customer> getCustomersNoCreditAccount();
    public List<Customer> getCustomersWithCreditAccount();
    public CreditGroup getPreviousCreditGroupDs(CreditGroup cg);
    public CreditGroup getNextCreditGroupDs(CreditGroup cg);
    public CreditGroup getPreviousCreditGroupWs(CreditGroup cg);
    public CreditGroup getNextCreditGroupWs(CreditGroup cg);
    
    public void checkUnpaidInvoices();
     public Customer getCustomer(Long id);
}
